﻿// See https://aka.ms/new-console-template for more information
using System.IO.MemoryMappedFiles;
using System.Text;

Console.WriteLine("内存映射文件读取者启动");
using (var mmf = MemoryMappedFile.OpenExisting("testmap"))
{
    Console.WriteLine("内存映射文件已经打开");
    using (var accessor = mmf.CreateViewAccessor())
    {
        var buffer = new byte[1000];
        accessor.ReadArray(0, buffer, 0, buffer.Length);
        string message = Encoding.UTF8.GetString(buffer);
        Console.WriteLine("读取到数据：" + message);
        Console.ReadLine();
    }
}
